﻿IF EXISTS (SELECT * from sys.procedures p left join sys.schemas s on p.schema_id = s.schema_id where p.name='line_select_by_budgetid' and s.name='Budget')
DROP PROCEDURE [Budget].line_select_by_budgetid
GO
CREATE PROCEDURE [Budget].line_select_by_budgetid 
@BudgetID uniqueidentifier
AS
BEGIN
SELECT 	
	[Lines].[id_line] AS [PK],
	[Lines].[id_budget] AS [BudgetID],
	[Lines].[id_category] AS [CategoryID],
	[Lines].[id_parent] AS [ParentID],
	[Lines].[code] AS [Code],
	[Lines].[name] AS [Name],
	[Lines].[amount] AS [Amount],
	[Lines].[description] AS [Description]
FROM 
	[Lines] 
WHERE
	[Lines].[id_budget] = @BudgetID 
END